cmake_minimum_required(VERSION 3.22)
project(RAFT-KV-DATABASE)

set(CMKAE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPIER /usr/bin/g++)

set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 17)

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -Wall -g -fstack-protector-all")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wall -g -fstack-protector-all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2")

include_directories(${PROJECT_SOURCE_DIR}/src/skiplist/include)
include_directories(${PROJECT_SOURCE_DIR}/src/rpc/include)
include_directories(${PROJECT_SOURCE_DIR}/src/log/include)
include_directories(${PROJECT_SOURCE_DIR}/src/ThreadTool/include)
include_directories(${PROJECT_SOURCE_DIR}/src/raftRPC/include)
include_directories(${PROJECT_SOURCE_DIR}/src/kvServerRPC/include)
include_directories(${PROJECT_SOURCE_DIR}/src/raftCore/include)
include_directories(${PROJECT_SOURCE_DIR}/src/common/include)
message(STATUS "Include directories: ${PROJECT_SOURCE_DIR}/src/skip-list/include")


set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY  ${PROJECT_SOURCE_DIR}/lib)
#message(STATUS "Library output directory: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")

add_library(skip_list_on_raft ${src_rpc} ${src_raftRpcPro} ${src_KVServerRpcPro} ${src_raftCore} ${src_common})
target_link_libraries(skip_list_on_raft muduo_net muduo_base pthread dl)

add_subdirectory(src)

add_executable(test test.cpp )